//
//  GQRegisterDetailController.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/6.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQRegisterDetailController.h"
#import "GQIconCell.h"
#import "GQModifyNameController.h"
#import "GQSiteController.h"
#import "GQInfomationController.h"
#import "GQLabelController.h"
#import "GQFriendController.h"
#import "GQAreaInfo.h"
#import "GQCitiesInfo.h"
#import "GQRegisterInfo.h"
#import "TipView.h"
#import "GQLocationProvinceController.h"
#import "GQRegisterRegParam.h"
#import "MJExtension.h"
#import "GQRegisterTool.h"
#import "GQRegisterRegResult.h"
#import "GQProfileTool.h"
#import "GQLoginUserResult.h"
#import "GQLoginResult.h"

#define kFinishMargin 20

@interface GQRegisterDetailController () <UITableViewDataSource, UITableViewDelegate, UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate>

@property (weak, nonatomic) UIView *toolBarView;
@property (weak, nonatomic) UIPickerView *pickerView;
@property (weak, nonatomic) UIView *pickerToolView;
@property (weak, nonatomic) UIView *coverView;
@property (strong, nonatomic) NSArray *areaInfo;
@property (assign, nonatomic) NSInteger indexOfProvince;
@property (copy, nonatomic) NSString *oneStr;
@property (copy, nonatomic) NSString *twoStr;
@property (strong, nonatomic) UIDatePicker *datePicker;

@end

@implementation GQRegisterDetailController

- (NSArray *)areaInfo
{
    if (_areaInfo == nil) {
        _areaInfo = [GQAreaInfo areaInfoWithDict];
    }
    return _areaInfo;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.frame = CGRectMake(0, kNavigatationBarHeight, kScreenWidth, kScreenHeight - kNavigatationBarHeight);
    self.view.backgroundColor = kBackgroundColor;
    if ([self.type isEqualToString:@"edit"]) {
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithOriginalName:@"distribute_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backToPre)];
    }
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, self.view.width, 60 + (self.registerInfoArray.count - 1) * 44 + 64)];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.bounces = NO;
    tableView.backgroundColor = kBackgroundColor;
    self.tableView = tableView;
    [self.view addSubview:tableView];
    if (![self.type isEqualToString:@"edit"]) {
        [self setUpFinishButton];
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [self.tableView reloadData];
}

- (void)backToPre
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setUpFinishButton
{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(kFinishMargin, CGRectGetMaxY(self.tableView.frame) + kFinishMargin, (kScreenWidth - kFinishMargin * 2), 44)];
    [btn setBackgroundColor:[UIColor colorWithRed:18 / 255.0 green:38 / 255.0 blue:58 / 255.0 alpha:1.0]];
    [btn setTitle:@"完成" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize:14];
    btn.layer.masksToBounds = YES;
    btn.layer.cornerRadius = 5;
    [btn addTarget:self action:@selector(FinishBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}

#pragma mark - 点击完成按钮
- (void)FinishBtnClick
{
    
    [GQRegisterRegParam sharedGQRegisterRegParam].nick = [GQRegisterInfo sharedGQRegisterInfo].name;
    NSString *gender = [GQRegisterInfo sharedGQRegisterInfo].gender;
    NSInteger genderNum = 0;
    if ([gender isEqualToString:@"男"]) {
        genderNum = 1;
    }else if([gender isEqualToString:@"女"]){
        genderNum = 0;
    }
    
    GQRegisterRegParam *regParam = [GQRegisterRegParam sharedGQRegisterRegParam];
    GQRegisterInfo *regInfo = [GQRegisterInfo sharedGQRegisterInfo];
    
    
    if (![regInfo.name isEqualToString:@"未填写"] && ![regInfo.label containsObject:@"未填写"] &&![regInfo.location isEqualToString:@"未填写"] && ![regInfo.honour isEqualToString:@"未填写"]) {
        regParam.sex = genderNum;
        regParam.addrCode = regInfo.addrCode;
        regParam.prov = regInfo.prov;
        regParam.city = regInfo.location;
        regParam.intro = regInfo.honour;
        regParam.tags = [regInfo.tag componentsJoinedByString:@","];
        NSLog(@"%@", regParam.tags);
    }
    
    NSLog(@"%d", regParam.keyValues.count);
    
    if (regParam.keyValues.count == 10) {
        
        [GQRegisterTool registerUserInfo:regParam success:^(GQRegisterRegResult *result) {
            if (![result.errorCode integerValue]) {
                
                [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_smile"] tipText:@"注册成功"];
                
                GQFriendController *GQFC = [[GQFriendController alloc] init];
                GQFC.view.backgroundColor = [UIColor lightGrayColor];
                [self.navigationController pushViewController:GQFC animated:YES];
            }
        } failure:^(NSError *error) {
            
        }];
    }
}

- (void)backBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.registerInfoArray.count;
}

#pragma mark - 展示个人信息
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *flag = @"flag";
    if (indexPath.row == 0) {
        GQIconCell *cell = [[GQIconCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.textLabel.text = self.registerInfoArray[0];
        cell.textLabel.font = [UIFont systemFontOfSize:14];
        cell.image = [GQRegisterInfo sharedGQRegisterInfo].icon;
        return cell;
    }
    

    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:flag];
    
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    cell.textLabel.text = self.registerInfoArray[indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:15];
    
    if (indexPath.row == 1) {
        cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].name;
    }
    
    if (indexPath.row == 2) {
        cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].gender;
    }
    
    if (indexPath.row == 3) {
        NSString *str = [GQRegisterInfo sharedGQRegisterInfo].label[0];
        if ([str isEqualToString:@"未填写"]) {
            cell.detailTextLabel.text = @"未填写";
        }else{
            cell.detailTextLabel.text = @"";
            UIView *labelView = [self setUpLabelDetail];
            labelView.frame = CGRectMake(cell.width - 235, (cell.height - 20) / 2, 210, 20);
            [cell addSubview:labelView];
        }
    }
    
    if ([self.type isEqualToString:@"edit"]) {
        if (indexPath.row == 4) {
            cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].birthday;
        }
        if (indexPath.row == 5) {
            cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].location;
        }
        if(indexPath.row == 6){
            cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].honour;
        }
    }else{
        if (indexPath.row == 4) {
            NSLog(@"%@", [GQRegisterInfo sharedGQRegisterInfo].location);
            cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].location;
        }
        
        if (indexPath.row == 5) {
            cell.detailTextLabel.text = [GQRegisterInfo sharedGQRegisterInfo].honour;
        }
    }
    
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(300, 0, 50, 50)];
    cell.backgroundView = label;
    cell.detailTextLabel.font = [UIFont systemFontOfSize:13];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
    
}

- (UIView *)setUpLabelDetail
{
    UIView *containView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 210, 20)];
    NSInteger count = [GQRegisterInfo sharedGQRegisterInfo].label.count;
    count = count > 3 ? 3 : count;
    for (int i = count; i > 0; i--) {
        CGFloat btnH = containView.height;
        CGFloat margin = 5;
        CGFloat btnW = 60;
        UILabel *label = [[UILabel alloc] init];
        label.x = containView.width - (btnW + margin) * i;
        label.y = 0;
        label.width = btnW;
        label.height = btnH;
        NSString *str = [GQRegisterInfo sharedGQRegisterInfo].label[count - i];
        label.text = str;
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = [UIColor lightGrayColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.layer.masksToBounds = YES;
        label.layer.cornerRadius = 5;
        label.layer.borderWidth = 1;
        label.layer.borderColor = [UIColor lightGrayColor].CGColor;
        [containView addSubview:label];
    }
    return containView;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照", @"相册", nil];
        actionSheet.tag = 0;
        [actionSheet showInView:self.view];
    }
    if (indexPath.row == 2) {
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"男", @"女", nil];
        actionSheet.tag = 2;
        [actionSheet showInView:self.view];
    }
    if (indexPath.row == 1) {
        GQModifyNameController *GQMNC = [[GQModifyNameController alloc] init];
        GQMNC.name = [self tableView:tableView cellForRowAtIndexPath:indexPath].detailTextLabel.text;
        GQMNC.type = self.type;
        GQMNC.view.backgroundColor = kBackgroundColor;
        [self.navigationController pushViewController:GQMNC animated:YES];
    }
    if (indexPath.row == 3) {
        GQLabelController *GQLC = [[GQLabelController alloc] init];
        GQLC.type = self.type;
        GQLC.view.backgroundColor = [UIColor whiteColor];;
        [self.navigationController pushViewController:GQLC animated:YES];
    }
    
    if (self.registerInfoArray.count == 6) {
        if (indexPath.row == 4) {
            GQLocationProvinceController *GQLPC = [[GQLocationProvinceController alloc] init];
            [self.navigationController pushViewController:GQLPC animated:YES];
        }
        if (indexPath.row == 5) {
            GQInfomationController *GQIC = [[GQInfomationController alloc] init];
            GQIC.view.backgroundColor = kBackgroundColor;
            [self.navigationController pushViewController:GQIC animated:YES];
        }
    }else if(self.registerInfoArray.count == 7){
        if (indexPath.row == 4) {
            self.tableView.userInteractionEnabled = NO;
            CGFloat datePickerHeight = 216;
            UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.view.height - datePickerHeight, self.view.width, datePickerHeight)];
            self.datePicker = datePicker;
            datePicker.datePickerMode = UIDatePickerModeDate;
            datePicker.backgroundColor = [UIColor orangeColor];
            [self.view addSubview:datePicker];
            [self setBottomTool];
        }
        if (indexPath.row == 5) {
            GQSiteController *GQSC = [[GQSiteController alloc] init];
            GQSC.view.backgroundColor = kBackgroundColor;
            [self.navigationController pushViewController:GQSC animated:YES];
        }
        if (indexPath.row == 6) {
            GQInfomationController *GQIC = [[GQInfomationController alloc] init];
            GQIC.view.backgroundColor = kBackgroundColor;
            [self.navigationController pushViewController:GQIC animated:YES];
        }
    }

}

//#pragma mark - UIPicker的代理方法
//
//- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
//    return 2;
//}
//
//- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
//{
//    GQAreaInfo *areaInfo = self.areaInfo[_indexOfProvince];
//    if (component == 0) {
//        return self.areaInfo.count;
//    }else if(component == 1){
//        return areaInfo.cities.count;
//    }
//    return 0;
//}
//
//- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
//{
//    if (component == 0) {
//        self.indexOfProvince = row;
//        [pickerView reloadComponent:1];
//        [pickerView selectRow:0 inComponent:1 animated:YES];
//    }
//}
//
//- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
//{
//    UILabel *myView = nil;
//    if (component == 0) {
//        GQAreaInfo *areaInfo = self.areaInfo[row];
//        myView = [[UILabel alloc] initWithFrame:CGRectMake(-10, 0, 60, 30)];
//        myView.textAlignment = NSTextAlignmentCenter;
//        myView.font = [UIFont systemFontOfSize:13];
//        myView.text = areaInfo.state;
//        self.oneStr = myView.text;
//        myView.backgroundColor = [UIColor clearColor];
//    }else if(component == 1){
//        GQAreaInfo *areaInfo = self.areaInfo[_indexOfProvince];
//        GQCitiesInfo *citiesInfo = areaInfo.cities[row];
//        myView = [[UILabel alloc] initWithFrame:CGRectMake(-20, 0, 80, 30)];
//        myView.text = citiesInfo.city;
//        self.twoStr = myView.text;
//        myView.textAlignment = NSTextAlignmentCenter;
//        myView.font = [UIFont systemFontOfSize:13];
//        myView.backgroundColor = [UIColor clearColor];
//    }
//
//    return myView;
//}

//- (void)setUpAreaDataPicker
//{
//
//    UIView *coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
//    coverView.backgroundColor = [UIColor clearColor];
//    self.navigationController.navigationBar.userInteractionEnabled = NO;
//    [self.view addSubview:coverView];
//    self.coverView = coverView;
//    
//    CGFloat pickerHeight = 150;
//    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, self.view.height - pickerHeight, self.view.width, pickerHeight)];
//    pickerView.backgroundColor = [UIColor orangeColor];
//    pickerView.delegate = self;
//    pickerView.showsSelectionIndicator = NO;
//    self.pickerView = pickerView;
//    
//    CGFloat height = 35;
//    UIView *pickerToolBar = [[UIView alloc] initWithFrame:CGRectMake(0, pickerView.y - height, pickerView.width, height)];
//    pickerToolBar.backgroundColor = [UIColor blueColor];
//    self.pickerToolView = pickerToolBar;
//    //完成按钮
//    UIButton *finishBtn = [[UIButton alloc] initWithFrame:CGRectMake(pickerToolBar.width - 44, 0, 40, pickerToolBar.height)];
//    [finishBtn setTitle:@"完成" forState:UIControlStateNormal];
//    [finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    finishBtn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [finishBtn addTarget:self action:@selector(finishDidClick) forControlEvents:UIControlEventTouchUpInside];
//    [pickerToolBar addSubview:finishBtn];
//    //取消按钮
//    UIButton *cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(4, 0, 40, height)];
//    [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
//    [cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [cancelBtn addTarget:self action:@selector(cancelDidClick) forControlEvents:UIControlEventTouchUpInside];
//    [pickerToolBar addSubview:cancelBtn];
//    [self.view addSubview:pickerToolBar];
//    
//    [self.view addSubview:pickerView];
//}
//
//- (void)deallocPickerView
//{
//    self.navigationController.navigationBar.userInteractionEnabled = YES;
//    [self.coverView removeFromSuperview];
//    [self.pickerView removeFromSuperview];
//    [self.pickerToolView removeFromSuperview];
//    self.coverView = nil;
//    self.pickerView = nil;
//    self.pickerToolView = nil;
//}

//- (void)finishDidClick
//{
//    [self deallocPickerView];
//    [GQRegisterInfo sharedGQRegisterInfo].location = self.twoStr;
//    [self.tableView reloadData];
//    
//}
//
//- (void)cancelDidClick
//{
//    [self deallocPickerView];
//}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (actionSheet.tag == 2) {
        if (buttonIndex != 3) {
            NSLog(@"%d", buttonIndex);
            NSArray *actionArr = [NSArray arrayWithObjects:@"男", @"女", @"保密", nil];
            NSMutableDictionary *param = [NSMutableDictionary dictionary];
            [param setObject:[GQLoginResult sharedGQLoginResult].user.userId forKey:@"userId"];
            [param setObject:[NSString stringWithFormat:@"%d", 1 - buttonIndex] forKey:@"sex"];
            
            if ([self.type isEqualToString:@"edit"]) {
                [GQProfileTool profileModifyUserInfo:param modifyType:@"2" success:^(id result) {
                    NSInteger errorCode = [[result objectForKey:@"errorCode"] integerValue];
                    if (errorCode == 0) {
                        [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_smile"] tipText:@"修改成功"];
                    }else{
                        [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_sad"] tipText:@"修改失败"];
                    }
                } failure:^(NSError *error) {
                    
                }];
            }
    
            [GQRegisterInfo sharedGQRegisterInfo].gender = actionArr[buttonIndex];
            [self.tableView reloadData];
        }
    }else if(actionSheet.tag == 0){
        if (buttonIndex == 1) {
            UIImagePickerController *picker = [[UIImagePickerController alloc] init];
            picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            picker.delegate = self;
            picker.allowsEditing = YES;
            [self presentViewController:picker animated:YES completion:nil];
        }else if(buttonIndex == 0){
            if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) {
                UIImagePickerController *picker = [[UIImagePickerController alloc] init];
                picker.delegate = self;
                picker.sourceType = UIImagePickerControllerSourceTypeCamera;
                picker.allowsEditing = YES;
                [self presentViewController:picker animated:YES completion:nil];
            }else{
                [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_sad"] tipText:@"请检查摄像头是否可用"];
            }
        }
    }
}

#pragma mark - UIImagePicker的代理

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = info[UIImagePickerControllerEditedImage];
    UIImage *selectedImage = [UIImage imageRoundWithImage:image];
    
    UIImage *image1 = info[UIImagePickerControllerEditedImage];
    UIImage *uploadImage = [UIImage imageResizeWith:image1 imageSize:CGSizeMake(60, 60)];
    
    NSData *imageData = UIImagePNGRepresentation(uploadImage);
    NSString *base64Image = [imageData base64EncodedStringWithOptions:0];
    
    [GQRegisterRegParam sharedGQRegisterRegParam].image = base64Image;
    [GQRegisterInfo sharedGQRegisterInfo].icon = selectedImage;
    
    if ([self.type isEqualToString:@"edit"]) {
        NSMutableDictionary *param = [NSMutableDictionary dictionary];
        [param setObject:[GQLoginResult sharedGQLoginResult].user.userId forKey:@"userId"];
        [param setObject:base64Image forKey:@"image"];
        [GQProfileTool profileModifyUserInfo:param modifyType:@"0" success:^(id result) {
            NSInteger errorCode = [[result objectForKey:@"errorCode"] integerValue];
            if (errorCode == 0 ) {
                [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_smile"] tipText:@"修改头像成功"];
            }else{
                [TipView showToView:self.view tipImage:[UIImage imageNamed:@"login_sad"] tipText:@"修改头像失败"];
            }
        } failure:^(NSError *error) {
            
        }];
    }
    
    [self dismissViewControllerAnimated:YES completion:nil];

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)setBottomTool
{
    CGFloat height = 44;
    UIView *toolBarView = [[UIView alloc] init];
    toolBarView.x = 0;
    toolBarView.width = self.view.width;
    toolBarView.height = height;
    toolBarView.y = self.datePicker.y - height;
    toolBarView.backgroundColor = [UIColor  blueColor];
    self.toolBarView = toolBarView;
    
    UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    cancelBtn.x = 10;
    cancelBtn.width = 50;
    cancelBtn.height = toolBarView.height;
    cancelBtn.y = 0;
    [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
    cancelBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [cancelBtn addTarget:self action:@selector(cancelBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    [toolBarView addSubview:cancelBtn];
    
    UIButton *finishBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    finishBtn.width = 50;
    finishBtn.height = toolBarView.height;
    finishBtn.y = 0;
    finishBtn.x = toolBarView.width - 10 - finishBtn.width;
    [finishBtn setTitle:@"完成" forState:UIControlStateNormal];
    finishBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [finishBtn addTarget:self action:@selector(finishBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    [toolBarView addSubview:finishBtn];
    [self.view addSubview:toolBarView];
}

- (void)cancelBtnDidClick
{
    self.tableView.userInteractionEnabled = YES;
    [self.toolBarView removeFromSuperview];
    [self.datePicker removeFromSuperview];
}

- (void)finishBtnDidClick
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSString *dataStr = [dateFormatter stringFromDate:self.datePicker.date];
//    [self.textName replaceObjectAtIndex:4 withObject:dataStr];
    [self.toolBarView removeFromSuperview];
    [self.datePicker removeFromSuperview];
    self.tableView.userInteractionEnabled = YES;
    [self.tableView reloadData];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 60;
    }
    return 44;
}

-(NSArray *)registerInfoArray
{
    if (_registerInfoArray == nil) {
        _registerInfoArray = [NSMutableArray arrayWithObjects:@"头像", @"姓名", @"性别", @"标签", @"所在地", @"个人头衔", nil];
    }
    return _registerInfoArray;
}



@end
